﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="OhciUsbController"
	type="http://metalx.org/Usb/Ohci/OhciUsbController"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:lst="http://metalx.org/i386/Functions/List"
	xmlns:pcif="http://metalx.org/i386/Functions/Pci"
	xmlns:hex="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:bool="http://metalx.org/i386/Functions/Boolean"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands"
	xmlns:imm="http://metalx.org/Intel/80386/Immediate"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:index="http://metalx.org/Intel/80386/Index"
	xmlns:usb="http://metalx.org/Usb/Ohci/Registers"
	xmlns:end="http://metalx.org/Usb/Ohci/Endpoint"
	xmlns:trans="http://metalx.org/Usb/Ohci/Transfer"
	xmlns:com="http://metalx.org/Usb/Ohci/Communication">

	<cls:field name="Device" type="http://metalx.org/Pci/PciDevice" offset="0"/>

	<cls:method name="GetPorts" type="http://metalx.org/Usb/Ohci/OhciUsbPortList">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:PushAXToStack/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:AndAXWithImmediate/>
		<hex>000000ff</hex>

		<cpu:PushAXToStack/>

		<!--Create List-->
		<lst:Create/>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:CompareWithIndexAddress/>
		<index:SP/>
		<byte>0</byte>

		<cpu:BranchToRelative8IfNotEqual/>
		<addressOf ref="findClass" type="Relative8"/>

		<cpu:JumpToRelative/>
		<addressOf ref="createListObject" type="Relative32"/>
		
		<!--Find Class-->
		<label id="findClass"/>
		<cpu:PushDIToStack/>

		<sys:GetCatalog/>

		<cpu:CopyImmediateToDI/>
		<addressOf ref="ohciUsbPort" type="Absolute32"/>

		<cat:FindType/>

		<cpu:PullDXFromStack/>

		<cpu:PullCXFromStack/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-BXRegister/>

		<!--Create Objects-->
		<label id="forEachDevice"/>

		<!--<cpu:PushDIToStack/>-->

		<mm:CheckOut length="8"/>

		<!--<cpu:PullSIFromStack/>-->
		<cpu:PullAXFromStack/>
		<cpu:PushAXToStack/>
		<!--<cpu:PushSIToStack/>-->

		<cpu:CopyRegisterToOperand/>
		<op:AX-DIAddress/>

		<cpu:CopyRegisterToOperand/>
		<op:CX-AXRegister/>

		<cpu:DecrementAX/>

		<cpu:CopyRegisterToOperand/>
		<op:AX-DIAddressPlusImmediate8/>
		<byte>4</byte>

		<cpu:CopyImmediateToAX/>
		<int>8</int>

		<cpu:PushDXToStack/>

		<obj:Create/>

		<cpu:PullDXFromStack/>

		<cpu:CopyRegisterToOperand/>
		<op:DX-SIRegister/>

		<cpu:CopyRegisterToOperand/>
		<op:CX-AXRegister/>

		<cpu:DecrementAX/>

		<lst:SetItem/>

		<!--<cpu:PullDIFromStack/>-->

		<cpu:LoopToRelative8/>
		<addressOf ref="forEachDevice" type="Relative8"/>

		<!--Create List Object-->
		<label id="createListObject"/>

		<cpu:PullAXFromStack/>

		<!--Get Item Count-->
		<cpu:CopyOperandToRegister/>
		<op:AX-DXAddress/>

		<cpu:IncrementAX/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterLeft/>
		<byte>2</byte>

		<cpu:PushAXToStack/>
		<cpu:PushSIToStack/>
		<cpu:PushDXToStack/>

		<cpu:CopyImmediateToDI/>
		<addressOf ref="ohciUsbPortList" type="Absolute32"/>

		<sys:GetCatalog/>

		<cat:FindType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-BXRegister/>

		<cpu:PullDIFromStack/>
		<cpu:PullSIFromStack/>
		<cpu:PullAXFromStack/>

		<obj:Create/>

		<cpu:ReturnToNearCaller/>

		<var:string id="ohciUsbPort">http://metalx.org/Usb/Ohci/OhciUsbPort</var:string>
		<var:string id="ohciUsbPortList">http://metalx.org/Usb/Ohci/OhciUsbPortList</var:string>
	</cls:method>

	<cls:method name="Enable" type="http://metalx.org/Usb/Ohci/OhciUsbController">
		<cpu:PushDIToStack/>
		
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>
		
		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>
		
		<!--Read Frame Interval-->
		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:FrameInterval/>

		<cpu:PushAXToStack/>
		
		<!--Reset Controller-->
		<cpu:CopyImmediateToAX/>
		<int>1</int>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:CommandStatus/>
		
		<!--Wait For Suspended State-->
		<label id="waitForSuspendedState"/>
		
		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:Control/>

		<cpu:AndALWithImmediate/>
		<binary>11000000</binary>

		<cpu:CompareALToImmediate/>
		<binary>11000000</binary>

		<cpu:BranchToRelative8IfNotEqual/>
		<addressOf ref="waitForSuspendedState" type="Relative8"/>

		<!--Setup Control Endpoint Descriptor 0-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00220000</hex>
		<hex>00407800</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00220004</hex>
		<hex>00000000</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00220008</hex>
		<hex>00000000</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>0022000c</hex>
		<hex>00000000</hex>

		<!--Set Control Head-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:HeadControlEndpointDescriptorAddress/>
		<hex>00220000</hex>

		<!--<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:CurrentControlEndpointDescriptorAddress/>
		<hex>00220000</hex>-->

		<!--Setup Bulk Endpoint Descriptor 0-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00250000</hex>
		<hex>00400000</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00250004</hex>
		<hex>00000000</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>00250008</hex>
		<hex>00000000</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToImmediateAddress/>
		<hex>0025000c</hex>
		<hex>00000000</hex>

		<!--Set Bulk Head-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:HeadBulkEndpointDescriptorAddress/>
		<hex>00250000</hex>

		<!--<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:CurrentBulkEndpointDescriptorAddress/>
		<hex>00250000</hex>-->

		<!--Set Communication Area-->
		<cpu:CopyImmediateToDI/>
		<hex>00230000</hex>

		<cpu:CopyRegisterToOperand/>
		<op:DI-SIAddressPlusImmediate8/>
		<usb:CommunicationArea/>

		<!--Setup Interrupt Endpoint Schedule-->
		<cpu:CopyImmediateToAX/>
		<!--<hex>00220000</hex>-->
		<hex>00000000</hex>

		<cpu:CopyImmediateToCX/>
		<int>32</int>

		<cpu:Repeat/>
		<cpu:CopyAXToDIAddressAndIncrementDI/>

		<cpu:CopyImmediateToAX/>
		<hex>00000000</hex>

		<cpu:CopyImmediateToCX/>
		<int>32</int>

		<cpu:Repeat/>
		<cpu:CopyAXToDIAddressAndIncrementDI/>

		<!--Write Frame Interval-->
		<cpu:PullAXFromStack/>

		<cpu:AndAXWithImmediate/>
		<hex>00003fff</hex>

		<cpu:OrAXWithImmediate/>
		<hex>27780000</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:FrameInterval/>

		<!--Write Periodic Start-->
		<cpu:AndAXWithImmediate/>
		<hex>00003fff</hex>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>3</byte>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:PeriodicStartTime/>

		<!--Set State To Operational-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:Control/>
		<!--<hex>00000080</hex>-->
		<!--<hex>00000090</hex>-->
		<hex>000000b0</hex>

		<!--Power On Hub-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:RootHubStatus/>
		<hex>00010000</hex>

		<!--Disable Interrupts-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:InterruptDisable/>
		<hex>ffffffff</hex>
		<!--<hex>c000007f</hex>-->

		<!--Clear Interrupts-->
		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:InterruptStatus/>
		<hex>ffffffff</hex>
		<!--<hex>4000007f</hex>-->

		<!--Enable Interrupts-->
		<!--<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddressPlusImmediate8/>
		<usb:InterruptEnable/>
		<hex>c000007f</hex>-->

		<!--Disable Ports-->
		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:AndAXWithImmediate/>
		<hex>000000ff</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-CXRegister/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-AXRegister/>

		<cpu:AddImmediateToAX/>
		<hex>00000054</hex>

		<label id="nextPort"/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToAXAddress/>
		<hex>00000011</hex>
		
		<cpu:AddImmediateToAX/>
		<int>4</int>
		
		<cpu:LoopToRelative8/>
		<addressOf ref="nextPort" type="Relative8"/>

		<cpu:PullDIFromStack/>
		
		<cpu:ReturnToNearCaller/>
	</cls:method>
	
	<cls:method name="Disable" type="http://metalx.org/Usb/Ohci/OhciUsbController">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>1</int>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:CommandStatus/>

		<cpu:CopyImmediateToAX/>
		<hex>00000000</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddressPlusImmediate8/>
		<usb:Control/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetRevision" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetStatus" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:CommandStatus/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetDoneHead" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<!--<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadDoneTransferDescriptorAddress/>-->

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:CommunicationArea/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<com:HeadDoneTransferDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControlHead" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadControlEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControlCurrent" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:CurrentControlEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControlTransferHead" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadControlEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:HeadTransferDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControlTransferTail" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadControlEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:TailTransferDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControlNextEndpoint" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadControlEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetBulkHead" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadBulkEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetBulkCurrent" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:CurrentBulkEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetBulkTransferHead" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadBulkEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:HeadTransferDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetBulkTransferTail" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadBulkEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:TailTransferDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetBulkNextEndpoint" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:HeadBulkEndpointDescriptorAddress/>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<end:NextEndpointDescriptorAddress/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetRootHubStatus" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubStatus/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetControl" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:Control/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetRootHubDescriptorA" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsPowerSwitchable" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>9</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsPortPowerSwitchable" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>8</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsCompoundDevice" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>10</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsOvercurrentUnsupported" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>12</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsPortOvercurrentSupported" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>11</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetPowerOnTime" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorA/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>24</byte>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
	
	<cls:method name="GetRootHubDescriptorB" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubDescriptorB/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetFirstPortStatus" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:RootHubPortStatus/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetInterruptStatus" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:InterruptStatus/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ClearInterruptStatus" type="http://metalx.org/Usb/Ohci/OhciUsbController">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToAXAddressPlusImmediate8/>
		<usb:InterruptStatus/>
		<hex>ffffffff</hex>
		
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetEnabledInterrupts" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:InterruptEnable/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetFrameInterval" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:FrameInterval/>

		<cpu:AndAXWithImmediate/>
		<hex>00003fff</hex>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetMaximumPacketSize" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:FrameInterval/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>16</byte>

		<cpu:AndAXWithImmediate/>
		<hex>00008fff</hex>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetCurrentFrame" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:FrameNumber/>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetFrameTimeRemaining" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyOperandToRegister/>
		<op:AX-AXAddressPlusImmediate8/>
		<usb:FrameTimeRemaining/>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="deviceName" type="Absolute32"/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>

		<var:string id="deviceName">Universal Serial Bus 1.0 Controller (OHCI)</var:string>
	</cls:method>
	
	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>